'''Contains the layout for the Dell claim creator GUI.'''
import PySimpleGUI as sg
from warranty_manager.claim.common import (
    SUBMIT_COLOR,
    VIEW_COLOR,
    CANCEL_COLOR,
    TEXT_LABEL_SIZE,
    TEXT_INPUT_SIZE
)
from warranty_manager.claim.dell.common import (
    get_credentials_layout, get_add_parts_notes_layout
)


sg.theme('Reddit')

layout = [
    *get_credentials_layout(),
    [
        sg.T(
            'Service Tag',
            size=TEXT_LABEL_SIZE,
            tooltip="Dell's version of a device's serial number"
        ),
        sg.I(key='-TAG-', size=TEXT_INPUT_SIZE),
    ],
    [
        sg.T(
            'PO Number',
            size=TEXT_LABEL_SIZE,
            tooltip='The customer reference number used to track the order status'
        ),
        sg.I(key='-PO-', size=TEXT_INPUT_SIZE),
    ],
    [
        sg.T(
            'Phone Number',
            size=TEXT_LABEL_SIZE,
            tooltip='The contact phone number for the tech submitting the request'
        ),
        sg.I(key='-PHONE-', size=TEXT_INPUT_SIZE)
    ],
    [
        sg.T(
            'Address Name',
            size=TEXT_LABEL_SIZE,
            tooltip='The name given to the specified address '
            'in the TechDirect address book'
        ),
        sg.I(key='-ADDRESS-', size=TEXT_INPUT_SIZE)
    ],
    [
        sg.Frame('Ship-To Address', layout=[
            [
                sg.Button(
                    'Add Address',
                    tooltip='Adds a full address to the request',
                    key='-ADD_ADDRESS-',
                    button_color=SUBMIT_COLOR,
                    enable_events=True
                ),
                sg.Button(
                    'View Address',
                    tooltip='Views the address added to the request',
                    key='-VIEW_ADDRESS-',
                    button_color=VIEW_COLOR,
                    enable_events=True
                ),
                sg.Button(
                    'Remove Address',
                    tooltip='Removes the full address from the request',
                    key='-REMOVE_ADDRESS-',
                    button_color=CANCEL_COLOR,
                    enable_events=True
                )
            ],
        ],
        pad=(5, 5),
        tooltip='The full address information; it should only be used, if no address name is provided.'
        )
    ],
    *get_add_parts_notes_layout(),
    [
        sg.Checkbox(
            'Sandbox',
            key='-SANDBOX-',
            default=False,
            tooltip="Specifies whether or not to use the sandbox API endpoint"
        ),
        sg.Checkbox(
            'Multiple Devices',
            key='-MULTIPLE-',
            default=False,
            tooltip="Specifies whether or not there are multiple devices "
            "in a single ticket"
        ),
        sg.Checkbox(
            'Drop-Ship',
            key='-DROP_SHIP-',
            default=False,
            tooltip="Specifies whether or not to request a return to the repair depot"
        ),
        sg.Checkbox(
            'ADP',
            key='-ADP-',
            default=False,
            tooltip="Specifies whether or not the provided sevice tag "
            "has accidental damage"
        )
    ],
    [
        sg.Button(
            'Create Request',
            key='-CREATE_REQUEST-',
            button_color=('white', '#0000ff'),
            tooltip='Creates a new self-dispatch support request'
        ),
        sg.Button(
            'Load Parts',
            key='-LOAD_PARTS-',
            button_color=('white', '#8a2be2'),
            tooltip="Loads the dictionary of part descriptions and numbers"
            " from the specified JSON file"
        ),
        sg.Button(
            'Change Model',
            key='-CHANGE_MODEL-',
            button_color=('black', '#daa520'),
            tooltip='Sets all model-specific request fields back to their default values'
        ),
        sg.Cancel(button_color=CANCEL_COLOR)
    ]
]
